#!/bin/sh
#
#  Test errors
#

TestName="errors-test"
JobName=backup

. scripts/functions

scripts/cleanup
copy_test_confs

rm -f ${cwd}/tmp/*.log
/bin/cp -f scripts/susan-dir.conf.errors bin/susan-dir.conf

# Directory to backup.
# This directory will be created by setup_data().
BackupDirectory="${tmp}/data"

# Use a tgz to setup data to be backed up.
# Data will be placed at "${tmp}/data/".
setup_data data/small.tgz

# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
echo "${BackupDirectory}" >${tmp}/file-list


start_test

cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out /dev/null
messages
@$out ${cwd}/tmp/LOCAL_INC_ERR.log
label storage=File volume=TestVolume001
add storage=File2
1
File2
1
run job=LOCAL_INC_ERR yes
wait
messages
@$out ${cwd}/tmp/REMOTE_INC_ERR.log
run job=REMOTE_INC_ERR yes
wait
messages
@$out ${cwd}/tmp/LOCAL_EXCL_ERR.log
run job=LOCAL_EXCL_ERR yes
wait
messages
@$out ${cwd}/tmp/REMOTE_EXCL_ERR.log
run job=REMOTE_EXCL_ERR yes
wait
messages
@$out ${cwd}/tmp/REMOTE_RUNSCRIPT_ERR.log
run job=REMOTE_RUNSCRIPT_ERR yes
wait
messages
@$out ${cwd}/tmp/LOCAL_RUNSCRIPT_ERR.log
run job=LOCAL_RUNSCRIPT_ERR yes
wait
messages
@$out ${cwd}/tmp/CLIENT_CONNECT_TIMEOUT.log
run job=CLIENT_CONNECT_TIMEOUT yes
wait
messages
@$out ${cwd}/tmp/SD_CONNECT_TIMEOUT.log
run job=SD_CONNECT_TIMEOUT yes
wait
messages
status dir
status storage=File
quit
END_OF_DATA

run_susan
touch ${cwd}/tmp/log1.out
client=`grep client= $bin/susan-dir.conf`
check_for_zombie_jobs storage=File $client
stop_susan

dstat=0
bstat=0
rstat=0
export dstat
export bstat
export rstat


end_test
